package cc.wsyw126.java.mongoDB;

import cc.wsyw126.java.mongoDB.Utils.MongoDBJDBC;
import cc.wsyw126.java.mongoDB.Utils.ReflectBeanUtils;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by junpeng.yang on 17/1/9.
 */
public class MongoDBTest {
    public static void main(String args[]) {
        try {
            MongoDatabase mongoDB = MongoDBJDBC.getMongoDB();
            MongoCollection<Document> unit = mongoDB.getCollection("unit");
            System.out.println("unit = " + unit);
            FindIterable<Document> documents = unit.find();
            for (Document document : documents) {
                System.out.println("document = " + document);
            }
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
        }
    }

}
